package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ApiOrderMapper;
import com.ruoyi.system.domain.ApiOrder;
import com.ruoyi.system.service.IApiOrderService;

/**
 * 订单Service业务层处理
 * 
 * @author duantao
 * @date 2025-08-03
 */
@Service
public class ApiOrderServiceImpl implements IApiOrderService 
{
    @Autowired
    private ApiOrderMapper apiOrderMapper;

    /**
     * 查询订单
     * 
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public ApiOrder selectApiOrderById(Long id)
    {
        return apiOrderMapper.selectApiOrderById(id);
    }

    /**
     * 查询订单列表
     * 
     * @param apiOrder 订单
     * @return 订单
     */
    @Override
    public List<ApiOrder> selectApiOrderList(ApiOrder apiOrder)
    {
        return apiOrderMapper.selectApiOrderList(apiOrder);
    }

    /**
     * 新增订单
     * 
     * @param apiOrder 订单
     * @return 结果
     */
    @Override
    public int insertApiOrder(ApiOrder apiOrder)
    {
        apiOrder.setCreateTime(DateUtils.getNowDate());
        return apiOrderMapper.insertApiOrder(apiOrder);
    }

    /**
     * 修改订单
     * 
     * @param apiOrder 订单
     * @return 结果
     */
    @Override
    public int updateApiOrder(ApiOrder apiOrder)
    {
        apiOrder.setUpdateTime(DateUtils.getNowDate());
        return apiOrderMapper.updateApiOrder(apiOrder);
    }

    /**
     * 批量删除订单
     * 
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteApiOrderByIds(Long[] ids)
    {
        return apiOrderMapper.deleteApiOrderByIds(ids);
    }

    /**
     * 删除订单信息
     * 
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deleteApiOrderById(Long id)
    {
        return apiOrderMapper.deleteApiOrderById(id);
    }
}
